name: build dochub
on:
  push:
    tags:
    - v*

jobs:
  buildx:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Get git tag
      id: vars
      run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}

    - id: buildx
      uses: docker/setup-buildx-action@v1
      with:
        config-inline: |
          [registry."docker.io"]
            mirrors = ["mirror.gcr.io"]
    - name: Login to ghrc.io
      uses: docker/login-action@v1
      with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
    - name: Build and push
      id: docker_build
      uses: docker/build-push-action@v2
      with:
        push: true
        target: nginx
        tags: "ghcr.io/rabotaru/dochub:${{ steps.vars.outputs.tag }}"
